{template 'common/header'}
<ul class="nav nav-tabs" role="tablist">
    <li role="presentation" {if $operation == 'list'}class="active"{/if}><a href="{php echo $this->createWebUrl('huan',array('op'=>'list'));}">分类列表</a></li>
    <li role="presentation" {if $operation == 'add' || $operation == 'update'}class="active"{/if}><a href="{php echo $this->createWebUrl('huan',array('op'=>'add'));}">添加/编辑&nbsp;项目</a></li>
</ul>
{if $operation == 'list'}
<div class="panel panel-info">
    <div class="panel-heading">筛选</div>
    <div class="panel-body">
        <form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
            <input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="xuan_zyy" />
            <input type="hidden" name="do" value="huan" />
            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">项目</label>
                <div class="col-sm-8 col-lg-9 col-xs-12">
                   
                    <select name="type" class="form-control">
                        <option value="" {if $_GPC['type']==''}selected{/if}>请选择</option>
                        <option value="首页" {if $_GPC['type']=='首页'}selected{/if}>首页</option>

                        <option value="生成详情页" {if $_GPC['type']=='生成详情页'}selected{/if}>生成详情页</option>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
                <div class="col-sm-7 col-lg-9 col-xs-12">
                    <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                    <input type="hidden" name="token" value="{$_W['token']}" />
                    
                </div>
            </div>
            
            
            <div class="form-group">
            </div>
        </form>
    </div>
</div><div class="clearfix">
<div class="panel panel-default">
    <div class="panel-heading">总数：{$total}</div>
    <div class="panel-body">
        <table class="table table-hover" style="overflow:visible;">
            <thead class="navbar-inner">
                <tr>
                    <th style='width:80px;'>ID</th>
                    
                    <th style='width:80px;'>图片</th>
                    
                   
                    <th style='width:80px;'>排序</th>
                    <th style='width:80px;'>状态</th>
                    <th style='width:80px;'>分类</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {loop $list $row}
                <tr>
                    <td>   {$row['id']}</td>
                    <td>  <img src="{php echo tomedia($row['logo']);}" width="50px" height="50px"></td>
                    <td>   {$row['rank']}</td>
                    <td>   {if $row['status']==1}已发布{else}未发布{/if}</td>
                    <td>   {$row['type']}</td>
                    <td  style="overflow:visible;">
                        <div class="btn-group btn-group-sm" >
                            <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false" href="javascript:;">操作 <span class="caret"></span></a>
                            <ul class="dropdown-menu dropdown-menu-left" role="menu" style='z-index: 9999'>
                                
                                <li><a  href="{php echo $this->createWebUrl('huan',array('op'=>'update','id' => $row['id']));}" title='编辑' ><i class='fa fa-edit'></i> 编辑</a></li>
                                <li><a  href="{php echo $this->createWebUrl('huan',array('op'=>'delete','id' => $row['id']));}" title='删除' onclick="return confirm('确定要删除该项目吗？');"><i class='fa fa-remove'></i> 删除</a></li>
                            </ul>
                        </div>
                        
                    </td>
                </tr>
                {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
</div>
</div>
{else if $operation=='add' || $operation=='update'}
<div class="panel panel-info">
    <div class="panel-heading">操作</div>
    <div class="panel-body">
        <form action="" method="post" class="form-horizontal" role="form" id="form1">
            
            <input type="hidden" name="id" value="{$_GPC['id']}">
            <input type="hidden" name="post" value="1">
            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">幻灯片图片</label>
                <div class="col-sm-8 col-lg-9 col-xs-12">
                    {php echo tpl_form_field_image(logo,$item['logo']);}
                    <span class="help-block"></span>
                </div>
            </div>
            
            
           
            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">分类</label>
                <div class="col-sm-8 col-lg-9 col-xs-12">
                    
                    <select name="da[type]" class="form-control">
                        <option value="首页" {if $item['type']=='首页'}selected{/if}>首页（多张）</option>
                        <option value="生成详情页" {if $item['type']=='生成详情页'}selected{/if}>生成详情页（一张）</option>
                    </select>
                    <span class="help-block">幻灯片分类位置</span>
                </div>

            </div>


            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">URL</label>
                <div class="col-sm-8 col-lg-9 col-xs-12">
                    <input type="text" class="form-control"  name="da[url]" value="{$item['url']}" />
                    <span class="help-block">填入完整URL</span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">排序</label>
                <div class="col-sm-8 col-lg-9 col-xs-12">
                    <input type="number" class="form-control"  name="da[rank]" value="{$item['rank']}" />
                    <span class="help-block">排序越大越靠前</span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">发布</label>
                <div class="col-sm-8 col-lg-9 col-xs-12">
                    <select name="da[status]" class="form-control">
                        <option value="1" {if $item['status']==1}selected{/if}>是</option>
                        <option value="0" {if $item['status']==0}selected{/if}>否</option>
                    </select>
                    <span class="help-block">是否发布</span>
                </div>
            </div>


            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
                <div class="col-sm-7 col-lg-9 col-xs-12">
                    <input class="btn btn-default" type="submit" name="submit" value="提交">
                    <input type="hidden" name="token" value="{$_W['token']}" />
                    
                </div>
            </div>
            
        </form>
    </div>
</div>
{/if}
{template 'common/footer'}